<template>
	<view>
		<view class="exam-list">
			<view class="item" v-for="(v,k) in beforeList" :key="k" @click.stop="toBookDetail(k,v)">
				<view class="top">
					<view class="exam-title">
						{{v.title}}
						<view class="sub-title">
							试题60道，总分100分，及格60分，考试时间120分钟
						</view>
					</view>
				</view>
				<view class="bottom">
					<view class="left" @click.stop="toExam(v)">
						开始考试
					</view>
					<view class="right" @click.stop="toRecord(v)">
						考试记录
					</view>
				</view>
			</view>
		</view>
		<uni-popup ref="popup" :mask-click="false">
			<text>Popup</text>
			<button @click="close">关闭</button>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				scrollTop: 0,
				scrollH: 0,
				userInfo: "",
				beforeList: [{
						title: '2000年《高等数学》真题试卷',
						use: 10,
						sum: 100,
						rightPer: 65,
						isFree: 1
					},
					{
						title: '第二章 高等数学',
						use: 0,
						sum: 100,
						rightPer: 0,
						isFree: 0
					},
					{
						title: '第三章 高等物理',
						use: 0,
						sum: 100,
						rightPer: 0,
						isFree: 0
					}
				],
				book: {},
				sumPage: 0,
				page: 1,
				limit: 10,
			};
		},
		methods: {
			toExam(item) {
				uni.showModal({
					title:'模拟考试',
					content:'试卷总分100分，及格60分，总题数80题，考试时长：120分',
					confirmText:'开始答题',
					success: (r) => {
						if(r.confirm){
							this.$tools.toPage('pages/exam/list')
						}
					}
				})
			},
			toRecord(item) {
				this.$tools.toPage('pages/exam/record')
			},
			open() {
				this.$refs.popup.open('center')
			},
			close() {
				this.$refs.popup.close()
			}
		}
	}
</script>

<style lang="scss">
	.exam-list {
		margin: 25rpx 25rpx 50rpx 25rpx;

		.title {
			color: #333;
			font-size: 30rpx;
			margin-bottom: 40rpx;

			text {
				margin-left: 25rpx;
				color: #555;
				font-weight: normal;
				font-size: 30rpx
			}
		}

		.item {
			padding: 35rpx;
			margin-bottom: 25rpx;
			background: #fff;
			box-shadow: 0 3rpx 20rpx rgba(183, 183, 183, 0.3);
			border-radius: 10rpx;
			overflow: hidden;

			.top {
				border-bottom: 1rpx #cfcfcf solid;
				padding-bottom: 20rpx;
			}

			.bottom {
				padding-top: 20rpx;
				display: flex;
				justify-content: space-around;
				font-size: 28rpx;
				color: $themeColor;
			}

			.exam-title {
				font-size: 30rpx;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
				color: #333;

				.sub-title {
					font-size: 25rpx;
					color: #666;
				}
			}

		}
	}
</style>